#!/usr/bin/perl

use warnings;
use strict;

my %elective = (
    '2CPR2B' => 'C Language',
    '1UNX1B' => 'Intro to UNIX',
    '3SH414' => 'Shell Programming',
    '4PL400' => 'Perl Programming',
);

foreach my $key ( sort { $elective{$a} cmp $elective{$b} }
    keys %elective) {
    printf("%s\t\t%s\n", $key, $elective{$key});
}

print "Please enter the class number:\n";

chomp(my $class_num = <STDIN>);
printf ("You will be taking %s this semester.\n", $elective{$class_num});
